package com.zy.qudadid.ui.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.zy.lcpassenger.R;
import com.zy.qudadid.model.Message;
import com.zy.qudadid.presenter.OwnMsgPresenter;
import com.zy.qudadid.ui.activity.base.RecycleViewActivity;
import com.zy.qudadid.ui.adapter.OwnMsgAdapter;
import com.zy.qudadid.ui.view.OwnMsgView;
import com.zy.qudadid.utils.AESCrypt;
import com.zy.qudadid.utils.StringUtil;
import com.zy.qudadid.utils.UserUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by ninos on 2016/7/29.
 */
public class OwnMsgActivity extends RecycleViewActivity<OwnMsgPresenter, OwnMsgAdapter, Message> implements OwnMsgView {

    private ArrayList<Message> list = new ArrayList<>();

    @Override
    protected void initThings(Bundle savedInstanceState) {
        super.initThings(savedInstanceState);
        Map map = new HashMap();
//        map.put("uid", new UserUtil(getContext()).getUserId());
        map.put("type", "1");
        map.put("types", "1");
        String json = StringUtil.toJson(map);
        try {
            String data = StringUtil.replaceBlank(AESCrypt.getInstance().encrypt(json));
            presenter.GetMessage(data);
        } catch (Exception ex) {
        }

    }

    @Override
    protected OwnMsgAdapter provideAdapter() {
        return new OwnMsgAdapter(getContext(), presenter);
    }

    @Override
    protected RecyclerView.LayoutManager provideLayoutManager() {
        return new LinearLayoutManager(getContext());
    }

    @Override
    protected CharSequence provideTitle() {
        return "消息中心";
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_own_msg;
    }

    @Override
    public void initListeners() {

    }

    @Override
    public OwnMsgPresenter createPresenter() {
        return new OwnMsgPresenter();
    }

    @Override
    public void onItemClick(View view, int pos, Message item) {

    }

    @Override
    public void success(ArrayList<Message> list) {
        bd(list);
    }

    @Override
    public void error() {

    }
}
